import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};

const Home = () => import('../views/Discover.vue');
const Discovery = () => import('../views/Discover.vue');
const PlaylistDetail = () => import('../views/PlaylistDetail.vue');
const Playlists = () => import('../views/Playlists.vue');
const Songs = () => import('../views/Songs.vue');
const Mvs = () => import('../views/Mvs.vue');
const Playmv = () => import('../views/playmv.vue');

const routes = [
  {
    path: '/',
    name: 'discovery',
    component: Home,
  },
  {
    path: '/playmv',
    name: 'playmv',
    component: Playmv,
  },

  {
    path: '/discovery',
    name: 'discovery',
    component: Discovery,
  },
  {
    path: '/playlists',
    name: 'playlists',
    component: Playlists,
  },
  {
    path: '/songs',
    name: 'songs',
    component: Songs,
  },
  {
    path: '/mvs',
    name: 'mvs',
    component: Mvs,
  },
  {
    path: '/PlaylistDetail',
    // name: "PlaylistDetail",
    component: PlaylistDetail,
  },
];

const router = new VueRouter({
  routes,
});

export default router;
